//****************************************************************************
// Copyright (c) Microsoft Corporation. All rights reserved.
//****************************************************************************
using System;
using System.Configuration;
using System.Web.Configuration;
using Microsoft.FxCop.Sdk;
using System.Diagnostics.CodeAnalysis;

namespace Microsoft.FxCop.Rules.ASP.Security.Configuration
{
    sealed class DebugCompilationMustBeDisabled : SystemWebConfigurationIntrospectionRule
    {
        #region *** Constructor ***
        public DebugCompilationMustBeDisabled()
            : base(typeof(DebugCompilationMustBeDisabled).Name)
        {
        }
        #endregion

        #region *** SystemWebConfigurationIntrospectionRule ***
        protected override ProblemCollection Check(SystemWebSectionGroup webConfig)
        {
            if (webConfig == null)
                throw (new ArgumentNullException("webConfig"));

            if (webConfig.Compilation.Debug)
            {
                base.AddProblem(webConfig.Compilation.ElementInformation);
            }

            return base.Problems;
        }
        #endregion
    }
}